/** layui-v0.0.7 跨设备模块化前端框架@LGPL www.layui.com By 贤心 */
;
layui.define("jquery",
function(l) {
    var i = layui.jquery;
    l("layout", {
        tab: function(l) {
            var a = i(".layui-tab"),
            o = "layui-tab-this",
            s = '<div class="layui-tab-bar"><span class="layui-icon layui-tab-left">&#xe603;</span><span class="layui-icon layui-tab-right">&#xe602;</span></div>',
            n = function(l, a) {
                var o = 0,
                n = 0,
                c = l.find("li"),
                t = c.length;
                l[0].scrollWidth > a.width() ? (l.hasClass("layui-tab-scroll") || l.addClass("layui-tab-scroll"), a.append(s)) : (l.removeClass("layui-tab-scroll").css("left", 0), a.find(".layui-tab-bar").remove()),
                a.find(".layui-tab-bar>span").off("click").on("click",
                function() {
                    var l = i(this).index();
                    return 0 === l ? o--:o++,
                    0 > o ? o = 0 : o > t - 1 ? o = t - 1 : (n += (0 === l ? 1 : -1) * (c.eq(o - (0 === l ? 0 : 1)).outerWidth() + 1), void c.eq(0).css("margin-left", n))
                })
            };
            i.each(a,
            function(a) {
                var s = i(this),
                c = s.find(".layui-tab-title"),
                t = s.find(".layui-tab-item");
                c.find(">li").on("click",
                function() {
                    var l = i(this),
                    a = l.index();
                    l.hasClass(o) || (l.addClass(o).siblings("li").removeClass(o), t.eq(a).addClass("layui-show").siblings(".layui-tab-item").removeClass("layui-show"))
                }),
                n(c, s),
                i(window).on("resize",
                function() {
                    n(c, s)
                }),
                "funciton" == typeof l && l(a)
            })
        },
        fixBlock: function(l) {
            l = l || {};
            var a = {
                ask: "&#xe606;",
                help: "&#xe607;"
            },
            o = i('<ul class="layui-fixBlock"><li class="layui-icon layui-fixBlock-tool" style="' + (l.bgcolor ? "background-color:" + l.bgcolor: "") + '">' + a[l.toolType || "ask"] + '</li><li class="layui-icon layui-fixBlock-top" style="' + (l.bgcolor ? "background-color:" + l.bgcolor: "") + '">&#xe604;</li></ul>');
            i(".layui-fixBlock")[0] || i("body").append(o),
            o.find(".layui-fixBlock-tool").on("click", l.toolClick),
            o.find(".layui-fixBlock-top").on("click",
            function() {
                i("html, body").animate({
                    scrollTop: 0
                },
                200)
            });
            var s = 0,
            n = i(".layui-fixBlock-top"),
            c = function() {
                var a = i(window).scrollTop();
                return a >= (l.showHeight || 200) ? s || (n.show(), s = 1) : s && (n.hide(), s = 0),
                arguments.callee
            } ();
            i(window).on("scroll", c)
        }
    })
});